package com.css.fxfzxczh.modules.largeScreen.controller;

import com.css.fxfzxczh.base.response.RestResponse;
import com.css.fxfzxczh.modules.largeScreen.queryParams.QuaParams;
import com.css.fxfzxczh.modules.largeScreen.service.LargeScreenService;
import com.css.fxfzxczh.modules.largeScreen.vo.FieldDataProportionVo;
import com.css.fxfzxczh.modules.largeScreen.vo.IntensityMapVo;
import com.css.fxfzxczh.modules.largeScreen.vo.TypicalDamagePhotoVo;
import com.css.fxfzxczh.modules.map.entity.DrawSeismicInfluence;
import com.css.fxfzxczh.modules.synthesizeInfoManage.earEveManage.entity.EarEveManage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author
 * @program
 * @description
 * @create 2022/8/8 10:39
 **/
@RestController
@RequestMapping("/largeScreen")
@Slf4j
public class LargeScreenController {
    @Resource
    private LargeScreenService largeScreenService;

    /**
     * 根据条件查询符合条件的地震事件信息
     * @param
     * @return
     */
    @GetMapping("/getByCondition")
    public RestResponse getByCondition(QuaParams params) {
        RestResponse response = null;
        try {
            EarEveManage earEveManage = largeScreenService.getByCondition(params);
            response = RestResponse.succeed(earEveManage);
            response.setMessage("查询成功");
        } catch (Exception e) {
            String errormessage = "查询失败";
            log.error(errormessage, e);
            response = RestResponse.fail(errormessage);
        }
        return response;
    }

    /**
     * 获取每个地震事件下的烈度图数据
     * @param
     * @return
     */
    @GetMapping("/intensityMapData")
    public RestResponse intensityMapData() {
        RestResponse response = null;
        try {
            List<IntensityMapVo> list = largeScreenService.intensityMapData();
            response = RestResponse.succeed(list);
            response.setMessage("查询成功");
        } catch (Exception e) {
            String errormessage = "查询失败";
            log.error(errormessage, e);
            response = RestResponse.fail(errormessage);
        }
        return response;
    }


    /**
     * 获取每个地震事件下的现场数据占比
     *
     * @param
     * @return
     */
    @GetMapping("/getFieldDataProportion")
    public RestResponse getFieldDataProportion() {
        RestResponse response = null;
        try {
            List<FieldDataProportionVo> list = largeScreenService.getFieldDataProportion();
            response = RestResponse.succeed(list);
            response.setMessage("查询成功");
        } catch (Exception e) {
            String errormessage = "查询失败";
            log.error(errormessage, e);
            response = RestResponse.fail(errormessage);
        }
        return response;
    }



    /**
     * 获取典型破坏照片
     * @param
     * @return
     */
    @GetMapping("/getTypicalDamagePhoto")
    public RestResponse getTypicalDamagePhoto() {
        RestResponse response = null;
        try {
            List<TypicalDamagePhotoVo> list = largeScreenService.getTypicalDamagePhoto();
            response = RestResponse.succeed(list);
            response.setMessage("查询成功");
        } catch (Exception e) {
            String errormessage = "查询失败";
            log.error(errormessage, e);
            response = RestResponse.fail(errormessage);
        }
        return response;
    }
}
